#include<bits/stdc++.h> 
using namespace std;
#define int long long
#define endl '\n'
int a[30];

void solve() {
	int n; cin >> n;
	string s; cin >> s;
	int ans = 0;
	for (int i = 0; i < 26; i++) a[i] = 0;
	for (int i = 0; i < n; i++) {
		if (!a[s[i] - 'A']) {
			ans += 2;
			a[s[i] - 'A'] = 1;
		}else ans++;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T; cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}